#pragma once

#include "GamePart.h"
#include "MessageSender.h"
#include "DataAccesser.h"

namespace _DATAPARTFACTORY_
{
	namespace _GAME_
	{
		class WeaponFactory;
	}
}

namespace _DATAPART_
{
	namespace _GAME_
	{

		class Weapon:
			public GamePart
		{
			FoDeclareRTTI;

			friend class _DATAPARTFACTORY_::_GAME_::WeaponFactory;
		public:
			Weapon(void);
			~Weapon(void);
			void FireStart();
			void FireEnd();
			void Update(float elapsedtime);


			

			static _MODULE_::_GAME_::WeaponFireManager *g_ptrWeaponFireManager;
		protected:
			/**
			propertys
			*/
			//@{
			_FOGGE_::foUInt m_uiRateOfFire;//per second
			float m_fOverHeatLimit;
			float m_fCoolantCapacity;//remove a heat per sec
			//@}

			float m_fTotalHeat;//current total heat
			float m_fFireTimer;
			float m_fFireVelocityScalar;
			bool m_bFire;

			
			Bullet* m_ptrBulletTemplete;

			virtual void Fire(_FOMATH::Vector &fireLocation){}
			virtual _FOMATH::Vector GetFireStartLocation()
			{
				return GetLocation();
			}

			void CopyFrom(aDataPartBase* ptrSource);
		private:
			float m_fFireDelay;
			
		};
	}
}

namespace _DATAPARTFACTORY_
{
	namespace _GAME_
	{
		class WeaponFactory	:
			public GamePartFactory,
			public ::_FOGGE_::_GDB_::DataAccesser		

			
		{
		public:
			WeaponFactory(void);
			~WeaponFactory(void);

			_FOGGE_::_GDB_::aDataPartBase* LoadPart(TiXmlNode* ptrNode);
			
			_FOGGE_::_GDB_::aDataPartBase* CreatePart();
			
		};
	}
}
